| Author | Manuela Ruiz (mruiz@lcc.uma.es) |
Class that represents a 3D point
| returns | a Point object identical to this |
# File lib/geometry.rb, line 195
195: def clone()
196: return Point.new(@x, @y, @z)
197: end
| another_point | a Point object |
| returns | the distance between this point and another_point |
# File lib/geometry.rb, line 175
175: def distance(another_point)
176: return Math.sqrt((@x - another_point.x)**2 + (@y - another_point.y)**2)
177: end
| line_descriptor | a LineDescriptor object |
| a | a Point object of the line described by line_descriptor |
| b | a Point object of the line described by line_descriptor, distinct from a |
| returns | the point in the line_descriptor that is the ortogonal projection of this point on the line described by line_descriptor |
# File lib/geometry.rb, line 184
184: def project_to_line(line_descriptor, a, b)
185: r = ((a.y - @y)*(a.y - b.y) - (a.x - @x)*(b.x - a.x)).quo(Math.sqrt((b.x - a.x)**2 + (b.y - a.y)**2)**2)
186:
187: px = a.x + r*(b.x - a.x)
188: py = a.y + r*(b.y - a.y)
189:
190: return Point.new(px, py, 0)
191:
192: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.